{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Imports\n",
    "\n",
    "Import all the modules and functionalities we need."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "\n",
    "# Import standard libraries.\n",
    "import os\n",
    "\n",
    "# Import third party libraries.\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import seaborn as sns\n",
    "from statsmodels.stats.multitest import multipletests\n",
    "from statsmodels.stats.proportion import proportions_ztest\n",
    "\n",
    "# Import custom libraries/scripts.\n",
    "import annotations\n",
    "import helpers"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Loading data\n",
    "\n",
    "Fetch all our relevant data for the current analysis."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Set working contants.\n",
    "EXPERIMENTS_PATH = r'\\\\10.40.12.80\\home\\PhD\\Results\\Competition\\DL\\small_arenas\\WT_mating_pairs\\processed'\n",
    "FPS = 60\n",
    "N_MINUTES = 55\n",
    "N_FRAMES = N_MINUTES * 60 * FPS\n",
    "INK = 'black'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Set figure configurations.\n",
    "sns.set(\n",
    "        context='paper',\n",
    "        style='ticks',\n",
    "        font='sans-serif',\n",
    "        font_scale=1.0, \n",
    "        rc={\n",
    "            'axes.axisbelow': True,\n",
    "            'axes.edgecolor': INK,\n",
    "            'axes.facecolor': 'white' if INK=='black' else 'black',\n",
    "            'axes.grid': False,\n",
    "            'axes.labelcolor': INK,\n",
    "            'axes.labelsize': 13.0,\n",
    "            'axes.labelweight': 'normal',\n",
    "            'axes.linewidth': 1.0,\n",
    "            'axes.spines.left': True,\n",
    "            'axes.spines.bottom': True,\n",
    "            'axes.spines.top': False,\n",
    "            'axes.spines.right': False,\n",
    "            'axes.titlepad': 15.0,\n",
    "            'axes.titlesize': 20.0,\n",
    "            'axes.titleweight': 'bold',\n",
    "            'figure.facecolor': 'white' if INK=='black' else 'black',\n",
    "            'figure.figsize': [3.0, 4.0],\n",
    "            'figure.titlesize': 30.0,\n",
    "            'figure.titleweight': 'bold',\n",
    "            'font.family': ['sans-serif'],\n",
    "            'font.sans-serif': ['Arial'],\n",
    "            'legend.frameon': False,\n",
    "            'legend.fontsize': 11.0,\n",
    "            'lines.color': INK,\n",
    "            'lines.linewidth': 1.0,\n",
    "            'patch.edgecolor': INK,\n",
    "            'savefig.dpi': 300,\n",
    "            'savefig.format': 'png',\n",
    "            'savefig.bbox': 'tight',\n",
    "            'savefig.transparent': True,\n",
    "            'text.color': INK,\n",
    "            'text.usetex': False,\n",
    "            'xtick.color': INK,\n",
    "            'xtick.direction': 'out',\n",
    "            'xtick.labelsize': 12.0,\n",
    "            'xtick.major.pad': 5.0,\n",
    "            'xtick.major.size': 0.0,\n",
    "            'xtick.major.width': 1.0,\n",
    "            'xtick.minor.size': 0.0,\n",
    "            'xtick.minor.width': 0.4,\n",
    "            'ytick.color': INK,\n",
    "            'ytick.direction': 'out',\n",
    "            'ytick.labelsize': 12.0,\n",
    "            'ytick.major.pad': 5.0,\n",
    "            'ytick.major.size': 3.0,\n",
    "            'ytick.major.width': 1.0,\n",
    "            'ytick.minor.size': 0.0,\n",
    "            'ytick.minor.width': 0.4\n",
    "           }\n",
    "       )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Folder already exists, skipping.\n"
     ]
    }
   ],
   "source": [
    "# Prepare the Figures folder to save our graphs in.\n",
    "savepath = os.path.join(r'C:\\Users\\Miguel\\Desktop\\paper_data', 'paper_figures', 'figure4')\n",
    "try:\n",
    "    os.makedirs(savepath)\n",
    "    print('New folder created.')\n",
    "except FileExistsError:\n",
    "    print('Folder already exists, skipping.')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Paths to conditions:\n",
      " ['\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food', '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food']\n"
     ]
    }
   ],
   "source": [
    "# Set the conditions to analyze.\n",
    "condition_order = ['food', 'no_food']\n",
    "conditions = [item.path for item in os.scandir(EXPERIMENTS_PATH) if item.name in condition_order]\n",
    "print('Paths to conditions:\\n', conditions)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\t\n",
      " food\n",
      "\t\n",
      " no_food\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'food': ['\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena1.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena10.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena11.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena12.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena13.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena14.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena15.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena2.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena3.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena4.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena5.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena6.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena7.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena8.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-11-27T10_50_09_arena9.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-12-05T11_29_29_arena10.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-12-05T11_29_29_arena11.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-12-05T11_29_29_arena12.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-12-05T11_29_29_arena13.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-12-05T11_29_29_arena14.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-12-05T11_29_29_arena15.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-12-05T11_29_29_arena16.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-12-05T11_29_29_arena9.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-12-06T10_32_06_arena2.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-12-06T10_32_06_arena3.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-12-06T10_32_06_arena7.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\food\\\\video_2019-12-06T10_32_06_arena8.csv'],\n",
       " 'no_food': ['\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena10.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena11.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena12.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena13.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena14.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena16.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena2.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena3.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena4.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena5.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena7.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena8.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T10_28_30_arena9.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T11_29_29_arena1.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T11_29_29_arena2.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T11_29_29_arena5.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T11_29_29_arena7.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-05T11_29_29_arena8.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-06T10_32_06_arena10.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-06T10_32_06_arena11.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-06T10_32_06_arena12.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-06T10_32_06_arena13.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\WT_mating_pairs\\\\processed\\\\no_food\\\\video_2019-12-06T10_32_06_arena16.csv']}"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Load all usable experiments for each condition.\n",
    "experiments = {condition: [] for condition in condition_order}\n",
    "\n",
    "for condition_path in conditions:\n",
    "    \n",
    "    condition = os.path.basename(condition_path)\n",
    "    print('\\t\\n', condition)\n",
    "    \n",
    "    for item in os.scandir(condition_path):\n",
    "        if item.name.endswith('.csv'):\n",
    "            \n",
    "            annotation_video = annotations.read(item.path)\n",
    "\n",
    "            try:\n",
    "                copulation = annotation_video[0].events[0]\n",
    "\n",
    "                # Filter out videos where copulation is interrupted.\n",
    "                copulation_end = copulation.time_interval[1]\n",
    "                if copulation_end==N_FRAMES:\n",
    "                    print('Copulation interrupted:', item.name)\n",
    "                    continue\n",
    "\n",
    "                # Filter out videos where copulation lasts less than 8 minutes.\n",
    "                copulation_duration = copulation.duration\n",
    "                if copulation_duration <= 8 * 60 * FPS:\n",
    "                    print('Copulation too short:', item.name)\n",
    "                    continue\n",
    "            \n",
    "            except IndexError:\n",
    "                continue\n",
    "            \n",
    "            experiments[condition].append(item.path)\n",
    "\n",
    "experiments"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Aggression Analysis (First 5 Minutes ONLY)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Iteration: 0 \n",
      "Experiment: video_2019-11-27T10_50_09_arena1.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 1 \n",
      "Experiment: video_2019-11-27T10_50_09_arena10.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 2 \n",
      "Experiment: video_2019-11-27T10_50_09_arena11.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 3 \n",
      "Experiment: video_2019-11-27T10_50_09_arena12.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 4 \n",
      "Experiment: video_2019-11-27T10_50_09_arena13.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 5 \n",
      "Experiment: video_2019-11-27T10_50_09_arena14.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 6 \n",
      "Experiment: video_2019-11-27T10_50_09_arena15.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 7 \n",
      "Experiment: video_2019-11-27T10_50_09_arena2.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 8 \n",
      "Experiment: video_2019-11-27T10_50_09_arena3.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 9 \n",
      "Experiment: video_2019-11-27T10_50_09_arena4.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 10 \n",
      "Experiment: video_2019-11-27T10_50_09_arena5.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 11 \n",
      "Experiment: video_2019-11-27T10_50_09_arena6.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 12 \n",
      "Experiment: video_2019-11-27T10_50_09_arena7.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 13 \n",
      "Experiment: video_2019-11-27T10_50_09_arena8.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 14 \n",
      "Experiment: video_2019-11-27T10_50_09_arena9.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 15 \n",
      "Experiment: video_2019-12-05T11_29_29_arena10.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 16 \n",
      "Experiment: video_2019-12-05T11_29_29_arena11.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 17 \n",
      "Experiment: video_2019-12-05T11_29_29_arena12.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 18 \n",
      "Experiment: video_2019-12-05T11_29_29_arena13.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 19 \n",
      "Experiment: video_2019-12-05T11_29_29_arena14.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 20 \n",
      "Experiment: video_2019-12-05T11_29_29_arena15.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 21 \n",
      "Experiment: video_2019-12-05T11_29_29_arena16.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 22 \n",
      "Experiment: video_2019-12-05T11_29_29_arena9.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 23 \n",
      "Experiment: video_2019-12-06T10_32_06_arena2.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 24 \n",
      "Experiment: video_2019-12-06T10_32_06_arena3.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 25 \n",
      "Experiment: video_2019-12-06T10_32_06_arena7.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 26 \n",
      "Experiment: video_2019-12-06T10_32_06_arena8.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 0 \n",
      "Experiment: video_2019-12-05T10_28_30_arena10.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 1 \n",
      "Experiment: video_2019-12-05T10_28_30_arena11.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 2 \n",
      "Experiment: video_2019-12-05T10_28_30_arena12.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 3 \n",
      "Experiment: video_2019-12-05T10_28_30_arena13.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 4 \n",
      "Experiment: video_2019-12-05T10_28_30_arena14.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 5 \n",
      "Experiment: video_2019-12-05T10_28_30_arena16.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 6 \n",
      "Experiment: video_2019-12-05T10_28_30_arena2.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 7 \n",
      "Experiment: video_2019-12-05T10_28_30_arena3.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 8 \n",
      "Experiment: video_2019-12-05T10_28_30_arena4.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 9 \n",
      "Experiment: video_2019-12-05T10_28_30_arena5.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 10 \n",
      "Experiment: video_2019-12-05T10_28_30_arena7.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 11 \n",
      "Experiment: video_2019-12-05T10_28_30_arena8.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 12 \n",
      "Experiment: video_2019-12-05T10_28_30_arena9.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 13 \n",
      "Experiment: video_2019-12-05T11_29_29_arena1.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 14 \n",
      "Experiment: video_2019-12-05T11_29_29_arena2.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 15 \n",
      "Experiment: video_2019-12-05T11_29_29_arena5.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 16 \n",
      "Experiment: video_2019-12-05T11_29_29_arena7.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 17 \n",
      "Experiment: video_2019-12-05T11_29_29_arena8.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 18 \n",
      "Experiment: video_2019-12-06T10_32_06_arena10.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 19 \n",
      "Experiment: video_2019-12-06T10_32_06_arena11.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 20 \n",
      "Experiment: video_2019-12-06T10_32_06_arena12.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 21 \n",
      "Experiment: video_2019-12-06T10_32_06_arena13.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 22 \n",
      "Experiment: video_2019-12-06T10_32_06_arena16.csv \n",
      "Condition: no_food \n",
      "\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>has_aggression</th>\n",
       "      <th>has_food</th>\n",
       "      <th>aggression_latency</th>\n",
       "      <th>aggression_latency_mins</th>\n",
       "      <th>nframes</th>\n",
       "      <th>nbouts</th>\n",
       "      <th>ratio_frames</th>\n",
       "      <th>ratio_bouts</th>\n",
       "      <th>condition</th>\n",
       "      <th>experiment</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>1771.0</td>\n",
       "      <td>0.491944</td>\n",
       "      <td>504</td>\n",
       "      <td>5</td>\n",
       "      <td>0.028000</td>\n",
       "      <td>1.0</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena1.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>2032.0</td>\n",
       "      <td>0.564444</td>\n",
       "      <td>2112</td>\n",
       "      <td>13</td>\n",
       "      <td>0.117333</td>\n",
       "      <td>2.6</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena10.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>5507.0</td>\n",
       "      <td>1.529722</td>\n",
       "      <td>1340</td>\n",
       "      <td>11</td>\n",
       "      <td>0.074444</td>\n",
       "      <td>2.2</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena11.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>7035.0</td>\n",
       "      <td>1.954167</td>\n",
       "      <td>1784</td>\n",
       "      <td>8</td>\n",
       "      <td>0.099111</td>\n",
       "      <td>1.6</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena12.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>5045.0</td>\n",
       "      <td>1.401389</td>\n",
       "      <td>3045</td>\n",
       "      <td>7</td>\n",
       "      <td>0.169167</td>\n",
       "      <td>1.4</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena13.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>5699.0</td>\n",
       "      <td>1.583056</td>\n",
       "      <td>172</td>\n",
       "      <td>5</td>\n",
       "      <td>0.009556</td>\n",
       "      <td>1.0</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena14.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>3181.0</td>\n",
       "      <td>0.883611</td>\n",
       "      <td>507</td>\n",
       "      <td>7</td>\n",
       "      <td>0.028167</td>\n",
       "      <td>1.4</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena15.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>478.0</td>\n",
       "      <td>0.132778</td>\n",
       "      <td>2093</td>\n",
       "      <td>13</td>\n",
       "      <td>0.116278</td>\n",
       "      <td>2.6</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena2.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>2534.0</td>\n",
       "      <td>0.703889</td>\n",
       "      <td>1465</td>\n",
       "      <td>9</td>\n",
       "      <td>0.081389</td>\n",
       "      <td>1.8</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena3.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>906.0</td>\n",
       "      <td>0.251667</td>\n",
       "      <td>991</td>\n",
       "      <td>5</td>\n",
       "      <td>0.055056</td>\n",
       "      <td>1.0</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena4.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>5570.0</td>\n",
       "      <td>1.547222</td>\n",
       "      <td>1129</td>\n",
       "      <td>9</td>\n",
       "      <td>0.062722</td>\n",
       "      <td>1.8</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena5.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>2807.0</td>\n",
       "      <td>0.779722</td>\n",
       "      <td>424</td>\n",
       "      <td>5</td>\n",
       "      <td>0.023556</td>\n",
       "      <td>1.0</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena6.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>5892.0</td>\n",
       "      <td>1.636667</td>\n",
       "      <td>1092</td>\n",
       "      <td>9</td>\n",
       "      <td>0.060667</td>\n",
       "      <td>1.8</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena7.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>4860.0</td>\n",
       "      <td>1.350000</td>\n",
       "      <td>7</td>\n",
       "      <td>1</td>\n",
       "      <td>0.000389</td>\n",
       "      <td>0.2</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena8.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>366.0</td>\n",
       "      <td>0.101667</td>\n",
       "      <td>756</td>\n",
       "      <td>12</td>\n",
       "      <td>0.042000</td>\n",
       "      <td>2.4</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena9.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>1739.0</td>\n",
       "      <td>0.483056</td>\n",
       "      <td>615</td>\n",
       "      <td>5</td>\n",
       "      <td>0.034167</td>\n",
       "      <td>1.0</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena10.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>6810.0</td>\n",
       "      <td>1.891667</td>\n",
       "      <td>187</td>\n",
       "      <td>1</td>\n",
       "      <td>0.010389</td>\n",
       "      <td>0.2</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena11.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>2311.0</td>\n",
       "      <td>0.641944</td>\n",
       "      <td>216</td>\n",
       "      <td>3</td>\n",
       "      <td>0.012000</td>\n",
       "      <td>0.6</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena12.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>3917.0</td>\n",
       "      <td>1.088056</td>\n",
       "      <td>1289</td>\n",
       "      <td>10</td>\n",
       "      <td>0.071611</td>\n",
       "      <td>2.0</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena13.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>4861.0</td>\n",
       "      <td>1.350278</td>\n",
       "      <td>750</td>\n",
       "      <td>3</td>\n",
       "      <td>0.041667</td>\n",
       "      <td>0.6</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena14.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>2780.0</td>\n",
       "      <td>0.772222</td>\n",
       "      <td>1453</td>\n",
       "      <td>14</td>\n",
       "      <td>0.080722</td>\n",
       "      <td>2.8</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena15.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>4093.0</td>\n",
       "      <td>1.136944</td>\n",
       "      <td>409</td>\n",
       "      <td>7</td>\n",
       "      <td>0.022722</td>\n",
       "      <td>1.4</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena16.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>4224.0</td>\n",
       "      <td>1.173333</td>\n",
       "      <td>1086</td>\n",
       "      <td>20</td>\n",
       "      <td>0.060333</td>\n",
       "      <td>4.0</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena9.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-06T10_32_06_arena2.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>5927.0</td>\n",
       "      <td>1.646389</td>\n",
       "      <td>13</td>\n",
       "      <td>1</td>\n",
       "      <td>0.000722</td>\n",
       "      <td>0.2</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-06T10_32_06_arena3.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>7610.0</td>\n",
       "      <td>2.113889</td>\n",
       "      <td>713</td>\n",
       "      <td>13</td>\n",
       "      <td>0.039611</td>\n",
       "      <td>2.6</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-06T10_32_06_arena7.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>5674.0</td>\n",
       "      <td>1.576111</td>\n",
       "      <td>166</td>\n",
       "      <td>4</td>\n",
       "      <td>0.009222</td>\n",
       "      <td>0.8</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-06T10_32_06_arena8.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena10.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>11870.0</td>\n",
       "      <td>3.297222</td>\n",
       "      <td>106</td>\n",
       "      <td>1</td>\n",
       "      <td>0.005889</td>\n",
       "      <td>0.2</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena11.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena12.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena13.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>11558.0</td>\n",
       "      <td>3.210556</td>\n",
       "      <td>8</td>\n",
       "      <td>1</td>\n",
       "      <td>0.000444</td>\n",
       "      <td>0.2</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena14.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena16.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena2.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena3.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>14878.0</td>\n",
       "      <td>4.132778</td>\n",
       "      <td>48</td>\n",
       "      <td>2</td>\n",
       "      <td>0.002667</td>\n",
       "      <td>0.4</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena4.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>10280.0</td>\n",
       "      <td>2.855556</td>\n",
       "      <td>25</td>\n",
       "      <td>2</td>\n",
       "      <td>0.001389</td>\n",
       "      <td>0.4</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena5.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>13813.0</td>\n",
       "      <td>3.836944</td>\n",
       "      <td>8</td>\n",
       "      <td>1</td>\n",
       "      <td>0.000444</td>\n",
       "      <td>0.2</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena7.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>15484.0</td>\n",
       "      <td>4.301111</td>\n",
       "      <td>56</td>\n",
       "      <td>1</td>\n",
       "      <td>0.003111</td>\n",
       "      <td>0.2</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena8.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>39</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>2509.0</td>\n",
       "      <td>0.696944</td>\n",
       "      <td>35</td>\n",
       "      <td>2</td>\n",
       "      <td>0.001944</td>\n",
       "      <td>0.4</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena9.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena1.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena2.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>42</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena5.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>43</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>6592.0</td>\n",
       "      <td>1.831111</td>\n",
       "      <td>51</td>\n",
       "      <td>1</td>\n",
       "      <td>0.002833</td>\n",
       "      <td>0.2</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena7.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>44</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena8.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>45</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-06T10_32_06_arena10.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>46</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>977.0</td>\n",
       "      <td>0.271389</td>\n",
       "      <td>94</td>\n",
       "      <td>2</td>\n",
       "      <td>0.005222</td>\n",
       "      <td>0.4</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-06T10_32_06_arena11.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>47</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-06T10_32_06_arena12.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>48</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>11979.0</td>\n",
       "      <td>3.327500</td>\n",
       "      <td>20</td>\n",
       "      <td>2</td>\n",
       "      <td>0.001111</td>\n",
       "      <td>0.4</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-06T10_32_06_arena13.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-06T10_32_06_arena16.csv</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    has_aggression  has_food  aggression_latency  aggression_latency_mins  \\\n",
       "0             True      True              1771.0                 0.491944   \n",
       "1             True      True              2032.0                 0.564444   \n",
       "2             True      True              5507.0                 1.529722   \n",
       "3             True      True              7035.0                 1.954167   \n",
       "4             True      True              5045.0                 1.401389   \n",
       "5             True      True              5699.0                 1.583056   \n",
       "6             True      True              3181.0                 0.883611   \n",
       "7             True      True               478.0                 0.132778   \n",
       "8             True      True              2534.0                 0.703889   \n",
       "9             True      True               906.0                 0.251667   \n",
       "10            True      True              5570.0                 1.547222   \n",
       "11            True      True              2807.0                 0.779722   \n",
       "12            True      True              5892.0                 1.636667   \n",
       "13            True      True              4860.0                 1.350000   \n",
       "14            True      True               366.0                 0.101667   \n",
       "15            True      True              1739.0                 0.483056   \n",
       "16            True      True              6810.0                 1.891667   \n",
       "17            True      True              2311.0                 0.641944   \n",
       "18            True      True              3917.0                 1.088056   \n",
       "19            True      True              4861.0                 1.350278   \n",
       "20            True      True              2780.0                 0.772222   \n",
       "21            True      True              4093.0                 1.136944   \n",
       "22            True      True              4224.0                 1.173333   \n",
       "23           False      True                 NaN                 0.000000   \n",
       "24            True      True              5927.0                 1.646389   \n",
       "25            True      True              7610.0                 2.113889   \n",
       "26            True      True              5674.0                 1.576111   \n",
       "27           False     False                 NaN                 0.000000   \n",
       "28            True     False             11870.0                 3.297222   \n",
       "29           False     False                 NaN                 0.000000   \n",
       "30           False     False                 NaN                 0.000000   \n",
       "31            True     False             11558.0                 3.210556   \n",
       "32           False     False                 NaN                 0.000000   \n",
       "33           False     False                 NaN                 0.000000   \n",
       "34           False     False                 NaN                 0.000000   \n",
       "35            True     False             14878.0                 4.132778   \n",
       "36            True     False             10280.0                 2.855556   \n",
       "37            True     False             13813.0                 3.836944   \n",
       "38            True     False             15484.0                 4.301111   \n",
       "39            True     False              2509.0                 0.696944   \n",
       "40           False     False                 NaN                 0.000000   \n",
       "41           False     False                 NaN                 0.000000   \n",
       "42           False     False                 NaN                 0.000000   \n",
       "43            True     False              6592.0                 1.831111   \n",
       "44           False     False                 NaN                 0.000000   \n",
       "45           False     False                 NaN                 0.000000   \n",
       "46            True     False               977.0                 0.271389   \n",
       "47           False     False                 NaN                 0.000000   \n",
       "48            True     False             11979.0                 3.327500   \n",
       "49           False     False                 NaN                 0.000000   \n",
       "\n",
       "    nframes  nbouts  ratio_frames  ratio_bouts condition  \\\n",
       "0       504       5      0.028000          1.0      food   \n",
       "1      2112      13      0.117333          2.6      food   \n",
       "2      1340      11      0.074444          2.2      food   \n",
       "3      1784       8      0.099111          1.6      food   \n",
       "4      3045       7      0.169167          1.4      food   \n",
       "5       172       5      0.009556          1.0      food   \n",
       "6       507       7      0.028167          1.4      food   \n",
       "7      2093      13      0.116278          2.6      food   \n",
       "8      1465       9      0.081389          1.8      food   \n",
       "9       991       5      0.055056          1.0      food   \n",
       "10     1129       9      0.062722          1.8      food   \n",
       "11      424       5      0.023556          1.0      food   \n",
       "12     1092       9      0.060667          1.8      food   \n",
       "13        7       1      0.000389          0.2      food   \n",
       "14      756      12      0.042000          2.4      food   \n",
       "15      615       5      0.034167          1.0      food   \n",
       "16      187       1      0.010389          0.2      food   \n",
       "17      216       3      0.012000          0.6      food   \n",
       "18     1289      10      0.071611          2.0      food   \n",
       "19      750       3      0.041667          0.6      food   \n",
       "20     1453      14      0.080722          2.8      food   \n",
       "21      409       7      0.022722          1.4      food   \n",
       "22     1086      20      0.060333          4.0      food   \n",
       "23        0       0      0.000000          0.0      food   \n",
       "24       13       1      0.000722          0.2      food   \n",
       "25      713      13      0.039611          2.6      food   \n",
       "26      166       4      0.009222          0.8      food   \n",
       "27        0       0      0.000000          0.0   no_food   \n",
       "28      106       1      0.005889          0.2   no_food   \n",
       "29        0       0      0.000000          0.0   no_food   \n",
       "30        0       0      0.000000          0.0   no_food   \n",
       "31        8       1      0.000444          0.2   no_food   \n",
       "32        0       0      0.000000          0.0   no_food   \n",
       "33        0       0      0.000000          0.0   no_food   \n",
       "34        0       0      0.000000          0.0   no_food   \n",
       "35       48       2      0.002667          0.4   no_food   \n",
       "36       25       2      0.001389          0.4   no_food   \n",
       "37        8       1      0.000444          0.2   no_food   \n",
       "38       56       1      0.003111          0.2   no_food   \n",
       "39       35       2      0.001944          0.4   no_food   \n",
       "40        0       0      0.000000          0.0   no_food   \n",
       "41        0       0      0.000000          0.0   no_food   \n",
       "42        0       0      0.000000          0.0   no_food   \n",
       "43       51       1      0.002833          0.2   no_food   \n",
       "44        0       0      0.000000          0.0   no_food   \n",
       "45        0       0      0.000000          0.0   no_food   \n",
       "46       94       2      0.005222          0.4   no_food   \n",
       "47        0       0      0.000000          0.0   no_food   \n",
       "48       20       2      0.001111          0.4   no_food   \n",
       "49        0       0      0.000000          0.0   no_food   \n",
       "\n",
       "                               experiment  \n",
       "0    video_2019-11-27T10_50_09_arena1.csv  \n",
       "1   video_2019-11-27T10_50_09_arena10.csv  \n",
       "2   video_2019-11-27T10_50_09_arena11.csv  \n",
       "3   video_2019-11-27T10_50_09_arena12.csv  \n",
       "4   video_2019-11-27T10_50_09_arena13.csv  \n",
       "5   video_2019-11-27T10_50_09_arena14.csv  \n",
       "6   video_2019-11-27T10_50_09_arena15.csv  \n",
       "7    video_2019-11-27T10_50_09_arena2.csv  \n",
       "8    video_2019-11-27T10_50_09_arena3.csv  \n",
       "9    video_2019-11-27T10_50_09_arena4.csv  \n",
       "10   video_2019-11-27T10_50_09_arena5.csv  \n",
       "11   video_2019-11-27T10_50_09_arena6.csv  \n",
       "12   video_2019-11-27T10_50_09_arena7.csv  \n",
       "13   video_2019-11-27T10_50_09_arena8.csv  \n",
       "14   video_2019-11-27T10_50_09_arena9.csv  \n",
       "15  video_2019-12-05T11_29_29_arena10.csv  \n",
       "16  video_2019-12-05T11_29_29_arena11.csv  \n",
       "17  video_2019-12-05T11_29_29_arena12.csv  \n",
       "18  video_2019-12-05T11_29_29_arena13.csv  \n",
       "19  video_2019-12-05T11_29_29_arena14.csv  \n",
       "20  video_2019-12-05T11_29_29_arena15.csv  \n",
       "21  video_2019-12-05T11_29_29_arena16.csv  \n",
       "22   video_2019-12-05T11_29_29_arena9.csv  \n",
       "23   video_2019-12-06T10_32_06_arena2.csv  \n",
       "24   video_2019-12-06T10_32_06_arena3.csv  \n",
       "25   video_2019-12-06T10_32_06_arena7.csv  \n",
       "26   video_2019-12-06T10_32_06_arena8.csv  \n",
       "27  video_2019-12-05T10_28_30_arena10.csv  \n",
       "28  video_2019-12-05T10_28_30_arena11.csv  \n",
       "29  video_2019-12-05T10_28_30_arena12.csv  \n",
       "30  video_2019-12-05T10_28_30_arena13.csv  \n",
       "31  video_2019-12-05T10_28_30_arena14.csv  \n",
       "32  video_2019-12-05T10_28_30_arena16.csv  \n",
       "33   video_2019-12-05T10_28_30_arena2.csv  \n",
       "34   video_2019-12-05T10_28_30_arena3.csv  \n",
       "35   video_2019-12-05T10_28_30_arena4.csv  \n",
       "36   video_2019-12-05T10_28_30_arena5.csv  \n",
       "37   video_2019-12-05T10_28_30_arena7.csv  \n",
       "38   video_2019-12-05T10_28_30_arena8.csv  \n",
       "39   video_2019-12-05T10_28_30_arena9.csv  \n",
       "40   video_2019-12-05T11_29_29_arena1.csv  \n",
       "41   video_2019-12-05T11_29_29_arena2.csv  \n",
       "42   video_2019-12-05T11_29_29_arena5.csv  \n",
       "43   video_2019-12-05T11_29_29_arena7.csv  \n",
       "44   video_2019-12-05T11_29_29_arena8.csv  \n",
       "45  video_2019-12-06T10_32_06_arena10.csv  \n",
       "46  video_2019-12-06T10_32_06_arena11.csv  \n",
       "47  video_2019-12-06T10_32_06_arena12.csv  \n",
       "48  video_2019-12-06T10_32_06_arena13.csv  \n",
       "49  video_2019-12-06T10_32_06_arena16.csv  "
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "aggression_df = pd.DataFrame()\n",
    "for condition in experiments.keys():\n",
    "    for h, experiment_path in enumerate(experiments[condition]):\n",
    "\n",
    "        experiment = os.path.basename(experiment_path)\n",
    "        \n",
    "        print('Iteration:', h, '\\nExperiment:', experiment, '\\nCondition:', condition, '\\n')\n",
    "        \n",
    "        # Exclude experiments without copulation (since aggression is only observed during copulation).\n",
    "        annotation_video = annotations.read(experiment_path)\n",
    "        try:\n",
    "            copulation = annotation_video[0].events[0]\n",
    "        except IndexError:\n",
    "            continue\n",
    "        \n",
    "        aggression_events = list(filter(lambda event: event.time < (copulation.time + 18000), annotation_video[1].events)) # Consider aggression only during the first 5 minutes of copulation.\n",
    "        n_events = len(aggression_events)\n",
    "\n",
    "        # In case there is aggression, do the necessary calculations.\n",
    "        if n_events > 0:\n",
    "            \n",
    "            aggression_latency =  aggression_events[0].time - copulation.time\n",
    "            aggression_latency_mins = aggression_latency / (60 * FPS)\n",
    "            \n",
    "            ratio_frames = sum([aggression.duration for aggression in aggression_events]) / (5 * 60 * FPS)\n",
    "            ratio_bouts = n_events / 5\n",
    "            \n",
    "            aggression_data = pd.DataFrame({'has_aggression': True,\n",
    "                                            'has_food': True if condition == 'food' else False,\n",
    "                                            'aggression_latency': aggression_latency,\n",
    "                                            'aggression_latency_mins': aggression_latency_mins,\n",
    "                                            'nframes': sum([aggression.duration for aggression in aggression_events]),\n",
    "                                            'nbouts': n_events,\n",
    "                                            'ratio_frames': ratio_frames,\n",
    "                                            'ratio_bouts': ratio_bouts,\n",
    "                                            'condition': condition,\n",
    "                                            'experiment': experiment},\n",
    "                                            index=[h],\n",
    "                                           )\n",
    "\n",
    "        # If not, preset our dictionary with default values.\n",
    "        else:\n",
    "            aggression_data = pd.DataFrame({'has_aggression': False,\n",
    "                                            'has_food': True if condition == 'food' else False,\n",
    "                                            'aggression_latency': np.nan,\n",
    "                                            'aggression_latency_mins': 0,\n",
    "                                            'nframes': 0,\n",
    "                                            'nbouts': 0,\n",
    "                                            'ratio_frames': 0, \n",
    "                                            'ratio_bouts': 0,\n",
    "                                            'condition': condition,\n",
    "                                            'experiment': experiment},\n",
    "                                            index=[h],\n",
    "                                           )\n",
    "\n",
    "        # Concatenate all data together.\n",
    "        aggression_df = pd.concat([aggression_df, aggression_data], ignore_index=True)\n",
    "\n",
    "aggression_df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Outlier Detection"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\t food \n",
      "\n",
      "[]\n",
      "Number data points considered outliers: 0\n",
      "Percent data points considered outliers: 0.0 %\n",
      "\n",
      "\t no_food \n",
      "\n",
      "[]\n",
      "Number data points considered outliers: 0\n",
      "Percent data points considered outliers: 0.0 %\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>has_aggression</th>\n",
       "      <th>has_food</th>\n",
       "      <th>aggression_latency</th>\n",
       "      <th>aggression_latency_mins</th>\n",
       "      <th>nframes</th>\n",
       "      <th>nbouts</th>\n",
       "      <th>ratio_frames</th>\n",
       "      <th>ratio_bouts</th>\n",
       "      <th>condition</th>\n",
       "      <th>experiment</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>1771.0</td>\n",
       "      <td>0.491944</td>\n",
       "      <td>504</td>\n",
       "      <td>5</td>\n",
       "      <td>0.028000</td>\n",
       "      <td>1.0</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena1.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>2032.0</td>\n",
       "      <td>0.564444</td>\n",
       "      <td>2112</td>\n",
       "      <td>13</td>\n",
       "      <td>0.117333</td>\n",
       "      <td>2.6</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena10.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>5507.0</td>\n",
       "      <td>1.529722</td>\n",
       "      <td>1340</td>\n",
       "      <td>11</td>\n",
       "      <td>0.074444</td>\n",
       "      <td>2.2</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena11.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>7035.0</td>\n",
       "      <td>1.954167</td>\n",
       "      <td>1784</td>\n",
       "      <td>8</td>\n",
       "      <td>0.099111</td>\n",
       "      <td>1.6</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena12.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>5045.0</td>\n",
       "      <td>1.401389</td>\n",
       "      <td>3045</td>\n",
       "      <td>7</td>\n",
       "      <td>0.169167</td>\n",
       "      <td>1.4</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena13.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>5699.0</td>\n",
       "      <td>1.583056</td>\n",
       "      <td>172</td>\n",
       "      <td>5</td>\n",
       "      <td>0.009556</td>\n",
       "      <td>1.0</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena14.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>3181.0</td>\n",
       "      <td>0.883611</td>\n",
       "      <td>507</td>\n",
       "      <td>7</td>\n",
       "      <td>0.028167</td>\n",
       "      <td>1.4</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena15.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>478.0</td>\n",
       "      <td>0.132778</td>\n",
       "      <td>2093</td>\n",
       "      <td>13</td>\n",
       "      <td>0.116278</td>\n",
       "      <td>2.6</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena2.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>2534.0</td>\n",
       "      <td>0.703889</td>\n",
       "      <td>1465</td>\n",
       "      <td>9</td>\n",
       "      <td>0.081389</td>\n",
       "      <td>1.8</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena3.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>906.0</td>\n",
       "      <td>0.251667</td>\n",
       "      <td>991</td>\n",
       "      <td>5</td>\n",
       "      <td>0.055056</td>\n",
       "      <td>1.0</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena4.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>5570.0</td>\n",
       "      <td>1.547222</td>\n",
       "      <td>1129</td>\n",
       "      <td>9</td>\n",
       "      <td>0.062722</td>\n",
       "      <td>1.8</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena5.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>2807.0</td>\n",
       "      <td>0.779722</td>\n",
       "      <td>424</td>\n",
       "      <td>5</td>\n",
       "      <td>0.023556</td>\n",
       "      <td>1.0</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena6.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>5892.0</td>\n",
       "      <td>1.636667</td>\n",
       "      <td>1092</td>\n",
       "      <td>9</td>\n",
       "      <td>0.060667</td>\n",
       "      <td>1.8</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena7.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>4860.0</td>\n",
       "      <td>1.350000</td>\n",
       "      <td>7</td>\n",
       "      <td>1</td>\n",
       "      <td>0.000389</td>\n",
       "      <td>0.2</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena8.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>366.0</td>\n",
       "      <td>0.101667</td>\n",
       "      <td>756</td>\n",
       "      <td>12</td>\n",
       "      <td>0.042000</td>\n",
       "      <td>2.4</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-11-27T10_50_09_arena9.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>1739.0</td>\n",
       "      <td>0.483056</td>\n",
       "      <td>615</td>\n",
       "      <td>5</td>\n",
       "      <td>0.034167</td>\n",
       "      <td>1.0</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena10.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>6810.0</td>\n",
       "      <td>1.891667</td>\n",
       "      <td>187</td>\n",
       "      <td>1</td>\n",
       "      <td>0.010389</td>\n",
       "      <td>0.2</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena11.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>2311.0</td>\n",
       "      <td>0.641944</td>\n",
       "      <td>216</td>\n",
       "      <td>3</td>\n",
       "      <td>0.012000</td>\n",
       "      <td>0.6</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena12.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>3917.0</td>\n",
       "      <td>1.088056</td>\n",
       "      <td>1289</td>\n",
       "      <td>10</td>\n",
       "      <td>0.071611</td>\n",
       "      <td>2.0</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena13.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>4861.0</td>\n",
       "      <td>1.350278</td>\n",
       "      <td>750</td>\n",
       "      <td>3</td>\n",
       "      <td>0.041667</td>\n",
       "      <td>0.6</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena14.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>2780.0</td>\n",
       "      <td>0.772222</td>\n",
       "      <td>1453</td>\n",
       "      <td>14</td>\n",
       "      <td>0.080722</td>\n",
       "      <td>2.8</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena15.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>4093.0</td>\n",
       "      <td>1.136944</td>\n",
       "      <td>409</td>\n",
       "      <td>7</td>\n",
       "      <td>0.022722</td>\n",
       "      <td>1.4</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena16.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>4224.0</td>\n",
       "      <td>1.173333</td>\n",
       "      <td>1086</td>\n",
       "      <td>20</td>\n",
       "      <td>0.060333</td>\n",
       "      <td>4.0</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena9.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-06T10_32_06_arena2.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>5927.0</td>\n",
       "      <td>1.646389</td>\n",
       "      <td>13</td>\n",
       "      <td>1</td>\n",
       "      <td>0.000722</td>\n",
       "      <td>0.2</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-06T10_32_06_arena3.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>7610.0</td>\n",
       "      <td>2.113889</td>\n",
       "      <td>713</td>\n",
       "      <td>13</td>\n",
       "      <td>0.039611</td>\n",
       "      <td>2.6</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-06T10_32_06_arena7.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>5674.0</td>\n",
       "      <td>1.576111</td>\n",
       "      <td>166</td>\n",
       "      <td>4</td>\n",
       "      <td>0.009222</td>\n",
       "      <td>0.8</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-06T10_32_06_arena8.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena10.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>11870.0</td>\n",
       "      <td>3.297222</td>\n",
       "      <td>106</td>\n",
       "      <td>1</td>\n",
       "      <td>0.005889</td>\n",
       "      <td>0.2</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena11.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena12.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena13.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>11558.0</td>\n",
       "      <td>3.210556</td>\n",
       "      <td>8</td>\n",
       "      <td>1</td>\n",
       "      <td>0.000444</td>\n",
       "      <td>0.2</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena14.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena16.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena2.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena3.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>14878.0</td>\n",
       "      <td>4.132778</td>\n",
       "      <td>48</td>\n",
       "      <td>2</td>\n",
       "      <td>0.002667</td>\n",
       "      <td>0.4</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena4.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>10280.0</td>\n",
       "      <td>2.855556</td>\n",
       "      <td>25</td>\n",
       "      <td>2</td>\n",
       "      <td>0.001389</td>\n",
       "      <td>0.4</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena5.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>13813.0</td>\n",
       "      <td>3.836944</td>\n",
       "      <td>8</td>\n",
       "      <td>1</td>\n",
       "      <td>0.000444</td>\n",
       "      <td>0.2</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena7.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>15484.0</td>\n",
       "      <td>4.301111</td>\n",
       "      <td>56</td>\n",
       "      <td>1</td>\n",
       "      <td>0.003111</td>\n",
       "      <td>0.2</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena8.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>39</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>2509.0</td>\n",
       "      <td>0.696944</td>\n",
       "      <td>35</td>\n",
       "      <td>2</td>\n",
       "      <td>0.001944</td>\n",
       "      <td>0.4</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T10_28_30_arena9.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena1.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena2.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>42</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena5.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>43</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>6592.0</td>\n",
       "      <td>1.831111</td>\n",
       "      <td>51</td>\n",
       "      <td>1</td>\n",
       "      <td>0.002833</td>\n",
       "      <td>0.2</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena7.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>44</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-05T11_29_29_arena8.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>45</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-06T10_32_06_arena10.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>46</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>977.0</td>\n",
       "      <td>0.271389</td>\n",
       "      <td>94</td>\n",
       "      <td>2</td>\n",
       "      <td>0.005222</td>\n",
       "      <td>0.4</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-06T10_32_06_arena11.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>47</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-06T10_32_06_arena12.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>48</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>11979.0</td>\n",
       "      <td>3.327500</td>\n",
       "      <td>20</td>\n",
       "      <td>2</td>\n",
       "      <td>0.001111</td>\n",
       "      <td>0.4</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-06T10_32_06_arena13.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-06T10_32_06_arena16.csv</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    has_aggression  has_food  aggression_latency  aggression_latency_mins  \\\n",
       "0             True      True              1771.0                 0.491944   \n",
       "1             True      True              2032.0                 0.564444   \n",
       "2             True      True              5507.0                 1.529722   \n",
       "3             True      True              7035.0                 1.954167   \n",
       "4             True      True              5045.0                 1.401389   \n",
       "5             True      True              5699.0                 1.583056   \n",
       "6             True      True              3181.0                 0.883611   \n",
       "7             True      True               478.0                 0.132778   \n",
       "8             True      True              2534.0                 0.703889   \n",
       "9             True      True               906.0                 0.251667   \n",
       "10            True      True              5570.0                 1.547222   \n",
       "11            True      True              2807.0                 0.779722   \n",
       "12            True      True              5892.0                 1.636667   \n",
       "13            True      True              4860.0                 1.350000   \n",
       "14            True      True               366.0                 0.101667   \n",
       "15            True      True              1739.0                 0.483056   \n",
       "16            True      True              6810.0                 1.891667   \n",
       "17            True      True              2311.0                 0.641944   \n",
       "18            True      True              3917.0                 1.088056   \n",
       "19            True      True              4861.0                 1.350278   \n",
       "20            True      True              2780.0                 0.772222   \n",
       "21            True      True              4093.0                 1.136944   \n",
       "22            True      True              4224.0                 1.173333   \n",
       "23           False      True                 NaN                 0.000000   \n",
       "24            True      True              5927.0                 1.646389   \n",
       "25            True      True              7610.0                 2.113889   \n",
       "26            True      True              5674.0                 1.576111   \n",
       "27           False     False                 NaN                 0.000000   \n",
       "28            True     False             11870.0                 3.297222   \n",
       "29           False     False                 NaN                 0.000000   \n",
       "30           False     False                 NaN                 0.000000   \n",
       "31            True     False             11558.0                 3.210556   \n",
       "32           False     False                 NaN                 0.000000   \n",
       "33           False     False                 NaN                 0.000000   \n",
       "34           False     False                 NaN                 0.000000   \n",
       "35            True     False             14878.0                 4.132778   \n",
       "36            True     False             10280.0                 2.855556   \n",
       "37            True     False             13813.0                 3.836944   \n",
       "38            True     False             15484.0                 4.301111   \n",
       "39            True     False              2509.0                 0.696944   \n",
       "40           False     False                 NaN                 0.000000   \n",
       "41           False     False                 NaN                 0.000000   \n",
       "42           False     False                 NaN                 0.000000   \n",
       "43            True     False              6592.0                 1.831111   \n",
       "44           False     False                 NaN                 0.000000   \n",
       "45           False     False                 NaN                 0.000000   \n",
       "46            True     False               977.0                 0.271389   \n",
       "47           False     False                 NaN                 0.000000   \n",
       "48            True     False             11979.0                 3.327500   \n",
       "49           False     False                 NaN                 0.000000   \n",
       "\n",
       "    nframes  nbouts  ratio_frames  ratio_bouts condition  \\\n",
       "0       504       5      0.028000          1.0      food   \n",
       "1      2112      13      0.117333          2.6      food   \n",
       "2      1340      11      0.074444          2.2      food   \n",
       "3      1784       8      0.099111          1.6      food   \n",
       "4      3045       7      0.169167          1.4      food   \n",
       "5       172       5      0.009556          1.0      food   \n",
       "6       507       7      0.028167          1.4      food   \n",
       "7      2093      13      0.116278          2.6      food   \n",
       "8      1465       9      0.081389          1.8      food   \n",
       "9       991       5      0.055056          1.0      food   \n",
       "10     1129       9      0.062722          1.8      food   \n",
       "11      424       5      0.023556          1.0      food   \n",
       "12     1092       9      0.060667          1.8      food   \n",
       "13        7       1      0.000389          0.2      food   \n",
       "14      756      12      0.042000          2.4      food   \n",
       "15      615       5      0.034167          1.0      food   \n",
       "16      187       1      0.010389          0.2      food   \n",
       "17      216       3      0.012000          0.6      food   \n",
       "18     1289      10      0.071611          2.0      food   \n",
       "19      750       3      0.041667          0.6      food   \n",
       "20     1453      14      0.080722          2.8      food   \n",
       "21      409       7      0.022722          1.4      food   \n",
       "22     1086      20      0.060333          4.0      food   \n",
       "23        0       0      0.000000          0.0      food   \n",
       "24       13       1      0.000722          0.2      food   \n",
       "25      713      13      0.039611          2.6      food   \n",
       "26      166       4      0.009222          0.8      food   \n",
       "27        0       0      0.000000          0.0   no_food   \n",
       "28      106       1      0.005889          0.2   no_food   \n",
       "29        0       0      0.000000          0.0   no_food   \n",
       "30        0       0      0.000000          0.0   no_food   \n",
       "31        8       1      0.000444          0.2   no_food   \n",
       "32        0       0      0.000000          0.0   no_food   \n",
       "33        0       0      0.000000          0.0   no_food   \n",
       "34        0       0      0.000000          0.0   no_food   \n",
       "35       48       2      0.002667          0.4   no_food   \n",
       "36       25       2      0.001389          0.4   no_food   \n",
       "37        8       1      0.000444          0.2   no_food   \n",
       "38       56       1      0.003111          0.2   no_food   \n",
       "39       35       2      0.001944          0.4   no_food   \n",
       "40        0       0      0.000000          0.0   no_food   \n",
       "41        0       0      0.000000          0.0   no_food   \n",
       "42        0       0      0.000000          0.0   no_food   \n",
       "43       51       1      0.002833          0.2   no_food   \n",
       "44        0       0      0.000000          0.0   no_food   \n",
       "45        0       0      0.000000          0.0   no_food   \n",
       "46       94       2      0.005222          0.4   no_food   \n",
       "47        0       0      0.000000          0.0   no_food   \n",
       "48       20       2      0.001111          0.4   no_food   \n",
       "49        0       0      0.000000          0.0   no_food   \n",
       "\n",
       "                               experiment  \n",
       "0    video_2019-11-27T10_50_09_arena1.csv  \n",
       "1   video_2019-11-27T10_50_09_arena10.csv  \n",
       "2   video_2019-11-27T10_50_09_arena11.csv  \n",
       "3   video_2019-11-27T10_50_09_arena12.csv  \n",
       "4   video_2019-11-27T10_50_09_arena13.csv  \n",
       "5   video_2019-11-27T10_50_09_arena14.csv  \n",
       "6   video_2019-11-27T10_50_09_arena15.csv  \n",
       "7    video_2019-11-27T10_50_09_arena2.csv  \n",
       "8    video_2019-11-27T10_50_09_arena3.csv  \n",
       "9    video_2019-11-27T10_50_09_arena4.csv  \n",
       "10   video_2019-11-27T10_50_09_arena5.csv  \n",
       "11   video_2019-11-27T10_50_09_arena6.csv  \n",
       "12   video_2019-11-27T10_50_09_arena7.csv  \n",
       "13   video_2019-11-27T10_50_09_arena8.csv  \n",
       "14   video_2019-11-27T10_50_09_arena9.csv  \n",
       "15  video_2019-12-05T11_29_29_arena10.csv  \n",
       "16  video_2019-12-05T11_29_29_arena11.csv  \n",
       "17  video_2019-12-05T11_29_29_arena12.csv  \n",
       "18  video_2019-12-05T11_29_29_arena13.csv  \n",
       "19  video_2019-12-05T11_29_29_arena14.csv  \n",
       "20  video_2019-12-05T11_29_29_arena15.csv  \n",
       "21  video_2019-12-05T11_29_29_arena16.csv  \n",
       "22   video_2019-12-05T11_29_29_arena9.csv  \n",
       "23   video_2019-12-06T10_32_06_arena2.csv  \n",
       "24   video_2019-12-06T10_32_06_arena3.csv  \n",
       "25   video_2019-12-06T10_32_06_arena7.csv  \n",
       "26   video_2019-12-06T10_32_06_arena8.csv  \n",
       "27  video_2019-12-05T10_28_30_arena10.csv  \n",
       "28  video_2019-12-05T10_28_30_arena11.csv  \n",
       "29  video_2019-12-05T10_28_30_arena12.csv  \n",
       "30  video_2019-12-05T10_28_30_arena13.csv  \n",
       "31  video_2019-12-05T10_28_30_arena14.csv  \n",
       "32  video_2019-12-05T10_28_30_arena16.csv  \n",
       "33   video_2019-12-05T10_28_30_arena2.csv  \n",
       "34   video_2019-12-05T10_28_30_arena3.csv  \n",
       "35   video_2019-12-05T10_28_30_arena4.csv  \n",
       "36   video_2019-12-05T10_28_30_arena5.csv  \n",
       "37   video_2019-12-05T10_28_30_arena7.csv  \n",
       "38   video_2019-12-05T10_28_30_arena8.csv  \n",
       "39   video_2019-12-05T10_28_30_arena9.csv  \n",
       "40   video_2019-12-05T11_29_29_arena1.csv  \n",
       "41   video_2019-12-05T11_29_29_arena2.csv  \n",
       "42   video_2019-12-05T11_29_29_arena5.csv  \n",
       "43   video_2019-12-05T11_29_29_arena7.csv  \n",
       "44   video_2019-12-05T11_29_29_arena8.csv  \n",
       "45  video_2019-12-06T10_32_06_arena10.csv  \n",
       "46  video_2019-12-06T10_32_06_arena11.csv  \n",
       "47  video_2019-12-06T10_32_06_arena12.csv  \n",
       "48  video_2019-12-06T10_32_06_arena13.csv  \n",
       "49  video_2019-12-06T10_32_06_arena16.csv  "
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "corrected_ratio_frames = pd.DataFrame()\n",
    "\n",
    "for condition in condition_order:\n",
    "\n",
    "    print('\\n\\t', condition, '\\n')\n",
    "\n",
    "    try:\n",
    "        dataset = aggression_df.query('condition==\"' + condition + '\"')['ratio_frames']\n",
    "\n",
    "        outlier_positions = helpers.check_outliers(dataset)\n",
    "        print(outlier_positions)\n",
    "\n",
    "        fresh_dataset = pd.DataFrame(helpers.remove_outliers(dataset, indices=outlier_positions))\n",
    "        fresh_dataset['condition'] = condition\n",
    "\n",
    "        corrected_ratio_frames = pd.concat([corrected_ratio_frames, fresh_dataset], axis=0)\n",
    "        \n",
    "    except ValueError as error:\n",
    "        print(error)\n",
    "\n",
    "aggression_df = aggression_df.loc[corrected_ratio_frames.index]\n",
    "aggression_df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Aggression Rate"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>condition</th>\n",
       "      <th>ratio_frames</th>\n",
       "      <th>has_food</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>food</td>\n",
       "      <td>0.028000</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>food</td>\n",
       "      <td>0.117333</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>food</td>\n",
       "      <td>0.074444</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>food</td>\n",
       "      <td>0.099111</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>food</td>\n",
       "      <td>0.169167</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  condition  ratio_frames  has_food\n",
       "0      food      0.028000      True\n",
       "1      food      0.117333      True\n",
       "2      food      0.074444      True\n",
       "3      food      0.099111      True\n",
       "4      food      0.169167      True"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ratio_frames_df = aggression_df.copy()[['condition', 'ratio_frames', 'has_food']]\n",
    "ratio_frames_df.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Statistics"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\t no_food \n",
      "\n",
      "Shapiro's Test: group 1 IS NOT normally distributed.\n",
      "D'Agostino's Test: group 1 IS NOT normally distributed.\n",
      "Shapiro's Test: group 2 IS NOT normally distributed.\n",
      "D'Agostino's Test: group 2 IS NOT normally distributed.\n",
      "Levene's Test for non-normally distributed samples:\n",
      "  p-value = 0.000002\n",
      "  All groups were sampled from populations with NOT IDENTICAL variances.\n",
      "\n",
      "Mann-Whitney p-value: 2.9407320690933132e-08 \n",
      "\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'no_food': 2.9407320690933132e-08}"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ratio_frames_pvalues = {}\n",
    "\n",
    "control = ratio_frames_df.query('condition==\"food\"')['ratio_frames']\n",
    "\n",
    "for condition in condition_order[1:]:\n",
    "\n",
    "    print('\\n\\t', condition, '\\n')\n",
    "\n",
    "    try:\n",
    "        test = ratio_frames_df.query('condition==\"' + condition + '\"')['ratio_frames']\n",
    "\n",
    "        temp_values = {'control': control, 'test': test}\n",
    "\n",
    "        pvalue_condition = helpers.run_statistics(temp_values)\n",
    "\n",
    "        ratio_frames_pvalues[condition] = pvalue_condition\n",
    "        \n",
    "    except ValueError as error:\n",
    "        print(error)\n",
    "    \n",
    "ratio_frames_pvalues"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Effect Size"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "no_food\n",
      "Large Efect: -1.0 \n",
      "\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'no_food': -1.0}"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ratio_frames_effect_sizes = {}\n",
    "\n",
    "control = ratio_frames_df.query('condition==\"food\"')['ratio_frames']\n",
    "\n",
    "for condition in condition_order[1:]:\n",
    "    \n",
    "    print(condition)\n",
    "    \n",
    "    test = ratio_frames_df.query('condition==\"' + condition +'\"')['ratio_frames']\n",
    "\n",
    "    median_diff = helpers.get_effect_size(control, test, method='median_diff')\n",
    "\n",
    "    ratio_frames_effect_sizes[condition] = median_diff\n",
    "    \n",
    "ratio_frames_effect_sizes"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Plot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAL8AAAEgCAYAAADlraIkAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+j8jraAAAgAElEQVR4nO3deXzM1/7H8ddMJotE9kVCZEVESGInuAnKrZbSVjVFiaLVNm1R2upyhfr1V1t7/WirllqLW1q7llYpqtbSiFiDLBIiIfsyk8n5/eHe6U1JzERmJsx5Ph55PMyZ78x8vuOdb85855zzVQghBJJkgZTmLkCSzEWGX7JYMvySxZLhlyyWDL9ksWT4JYtlkvCvXr2aiIgIIiMjiYqK4tixY2i1WsaPH0/Lli1p1qwZCxcuNEUpkvQnYWRnz54V3t7eIjMzUwghxPbt20XTpk3FZ599Jvr16yc0Go24efOmCAkJEYcPHzZ2OZKkY/Qjv62tLUuWLMHHxweADh06cO3aNdavX8+oUaNQqVS4uroSGxvL6tWrjV2OJOmojP0CAQEBBAQEACCEYOLEiTzxxBMkJSXRtGlT3Xa+vr4kJiYauxxJ0jHZB97i4mKGDBnCxYsXWbJkCZWVlSgUCt39QgisrKyqfXxCQgIKhUL3I0n3yyThT0tLIyoqCisrK/bs2YOLiwt+fn5kZmbqtsnMzMTX17fa50hISEAIg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kSuQmCC\n",
      "text/plain": [
       "<Figure size 180x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Initialize figure.\n",
    "n_conditions = ratio_frames_df['condition'].nunique()\n",
    "figure, axis = plt.subplots(figsize=(1.25*n_conditions, 4))\n",
    "\n",
    "# Draw the boxplot.\n",
    "sns.boxplot(x='condition',\n",
    "            y='ratio_frames',\n",
    "            data=ratio_frames_df,\n",
    "            order=condition_order,\n",
    "            palette=['steelblue', '#5e6472'],\n",
    "            width=0.6,\n",
    "            showfliers=False,\n",
    "            boxprops={'edgecolor': INK},\n",
    "            medianprops={'color': INK},\n",
    "            whiskerprops={'color': INK},\n",
    "            capprops={'color': INK}\n",
    "           )\n",
    "\n",
    "# Draw the swarmplot.\n",
    "sns.swarmplot(x='condition',\n",
    "              y='ratio_frames',\n",
    "              data=ratio_frames_df,\n",
    "              order=condition_order,\n",
    "              palette=['steelblue', '#5e6472'],\n",
    "              linewidth=0.75,\n",
    "              edgecolor=INK\n",
    "             )\n",
    "\n",
    "# Figure and axes formatting.\n",
    "axis.set_xlabel('')\n",
    "axis.set_xticklabels([''])\n",
    "axis.set_ylabel('Aggression Rate (%)')\n",
    "axis.set_ylim(0, 0.2)\n",
    "axis.set_yticks(np.arange(0, 0.2+0.001, 0.05))\n",
    "axis.set_yticklabels([int(y*100) for y in axis.get_yticks()])\n",
    "\n",
    "# Table definition.\n",
    "row1 = [str(ratio_frames_df.query('condition==\"'+condition+'\"').shape[0]) for condition in condition_order]\n",
    "row2 = ['With\\nfood', 'Without\\nfood']\n",
    "cell_text = np.array([row1, row2])\n",
    "\n",
    "row_labels = ['n =', '']\n",
    "summary_table = axis.table(cellText= cell_text,\n",
    "                           cellLoc='center',\n",
    "                           rowLabels=row_labels,\n",
    "                           rowLoc='center',\n",
    "                           colLoc='center'\n",
    "                          )\n",
    "\n",
    "summary_table.auto_set_font_size(False)\n",
    "summary_table.set_fontsize(11)\n",
    "\n",
    "properties = summary_table.properties()\n",
    "table_cells = properties['children']\n",
    "for cell in table_cells:\n",
    "    cell.set_height(0.12)\n",
    "    cell.set_alpha(0)\n",
    "\n",
    "# Draw statistical result.\n",
    "for p, condition in enumerate(condition_order[1:]):\n",
    "    sig_height = 6 if (ratio_frames_pvalues.get(condition, 'NaN') == 'NaN') or (ratio_frames_pvalues.get(condition, 'NaN') >= 0.05) else 2\n",
    "    helpers.plot_stattest_result(ax=axis,\n",
    "                                 x1=p+1,\n",
    "                                 x2=p+1,\n",
    "                                 p_value=ratio_frames_pvalues.get(condition, 'NaN'),\n",
    "                                 y=0.18,\n",
    "                                 ticksize=0,\n",
    "                                 xytext=(0,sig_height),\n",
    "                                 fontsize=13,\n",
    "                                 color=INK,\n",
    "                                 connector_color=INK\n",
    "                                )\n",
    "\n",
    "# Saving parameters.\n",
    "filename = 'aggression_rate_first_5mins_WT_mating_pairs'\n",
    "plt.savefig(os.path.join(savepath, filename))\n",
    "\n",
    "plt.show()\n",
    "plt.close()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
